package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.util.StringUtil;
import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

/**
 * 账号名/邮箱/手机号码找回密码验证请求参数类
 *
 * @author lijian
 * @version 2014年4月2日 - 下午8:04:48
 */
public class UserLostpasswordByAccountRequest extends Request {

	private String accountName;
	
	private String phone;
	
	private String email;
	
	/** */
	public UserLostpasswordByAccountRequest() {
	}
	
	@Override
	public void parse(HttpServletRequest request) {

		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.accountName = requestInfo.getParameter(ApiUrlParamEnum.accountName.getParamName(), "");
		this.email = requestInfo.getParameter(ApiUrlParamEnum.email.getParamName(), "");
		this.phone = requestInfo.getParameter(ApiUrlParamEnum.phone.getParamName(), "");
		
		if (StringUtil.isEmpty(accountName) && StringUtil.isEmpty(email) && StringUtil.isEmail(phone)) {
			throw new RequestIllegalException("账号名/邮箱/手机号码不能为空");
		}
	}

	public String getAccountName() {
		return accountName;
	}

	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	
}
